package com.qianfeng1.day6_java8.monday.lambda.fc.fc4;


import com.qianfeng1.day6_java8.monday.lambda.demo.User;

import java.util.function.Predicate;

/**
 * 作者：黎杭
 * 日期：2020/2/17
 * 用匿名内部类来实现
 */
public class Test3 {
    public static void main(String[] args) {
        // 认为合格
        Predicate<User> p = user -> 16 < user.getAge() && 30 > user.getAge() && "女".equals(user.getSex());// 匿名内部类实现
        boolean b = test1(p);
        System.err.println(b);
    }
    public static boolean test1(Predicate<User> p) {
        User u = new User("张三", 170, 45.0, 22, "女");
        boolean test = p.test(u);// 检测的结果
        return test;
    }
}
